<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 第五个实验 -->
    <script>//229971345周名霞
    function extractQQNumber(email) {  
		     // 检查输入是否为字符串且包含'@'  
		     if (typeof email === 'string' && email.includes('@')) {  
		         var atIndex = email.indexOf('@');  
		         var qqNumber = email.substring(0, atIndex);  
		         return qqNumber;  
		     } else {  
		         return '输入的不是有效的 QQ 邮箱地址！';     // 如果输入不是字符串或者不包含'@'，返回错误消息  
		     }  
		 }  
		 // 测试案例  
		 var testEmail1 = '123456789@qq.com';  
		 var testEmail2 = 'notvalid@email.com';  
		 var testEmail3 = '123456789'; // 不包含'@'  
		 var testEmail4 = '123456789@qq.com.cn'; // 非标准 QQ 邮箱格式  
		 console.log(extractQQNumber(testEmail1)); //  
		 console.log(extractQQNumber(testEmail2)); //  
		 console.log(extractQQNumber(testEmail3)); // 
		 console.log(extractQQNumber(testEmail4)); // 
    </script>
</script>   
</body>
</html>